package com.lry.basic.tencent;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.ocr.v20181119.OcrClient;
import com.tencentcloudapi.ocr.v20181119.models.BizLicenseOCRRequest;
import com.tencentcloudapi.ocr.v20181119.models.BizLicenseOCRResponse;

public class BizLicenseOCR
{
    public static void main(String [] args) {
        try{
            Credential cred = new Credential("AKIDYsxpX75Yv0sXyA7wTq7C4i8NN7kIYngL", "cz6xc5IGzXqslV0FKBqFPPDl37wb1DE3");
            
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("ocr.tencentcloudapi.com");

            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);
            OcrClient client = new OcrClient(cred, "ap-guangzhou", clientProfile);
            String params = "{\"ImageUrl\":\"https://images.xiaogemaicai.cn/20191127/10144787009302.jpg\"}";
            System.out.println(params);
            BizLicenseOCRRequest req = BizLicenseOCRRequest.fromJsonString(params, BizLicenseOCRRequest.class);

            BizLicenseOCRResponse resp = client.BizLicenseOCR(req);
            System.out.println(BizLicenseOCRRequest.toJsonString(resp));

        } catch (TencentCloudSDKException e) {
                System.out.println(e.toString());
        }

    }
    
}

